<?php
/**
 * Created by PhpStorm.
 * User: zzx
 * Date: 2017/10/18
 * Time: 下午9:13
 */


/**
 * redis连接实例
 */
function redis_con()
{
    global $config;

//    ini_set('default_socket_timeout', -1);
    $redis = new redis();
    $redis->pconnect($config['REDIS_SERVER'], $config['REDIS_PORT']);
    if ($config['REDIS_PWD']) {
        $redis->auth($config['REDIS_PWD']);
    }
    return $redis;
}
function redis_tcon()
{
    global $config;

//    ini_set('default_socket_timeout', -1);
    $redis = new redis();
    $redis->connect($config['REDIS_SERVER'], $config['REDIS_PORT']);
    if ($config['REDIS_PWD']) {
        $redis->auth($config['REDIS_PWD']);
    }
    return $redis;
}
